package com.atde._05_behavioral_design_patterns.command.remotecontrol;


/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._05_behavioral_design_patterns.command.remotecontrol
 * @Author: Del
 * @CreateTime: 2025-06-25  20:08
 * @Description: 命令模式：具体的命令类
 * @Version: 1.0
 */
public class LightOnCommand implements  Command{

    // 聚合一个接收者对象
    LightReceiver light;

    public LightOnCommand(LightReceiver light) {
        this.light = light;
    }

    @Override
    public void execute() {
        // 调用接收者的方法：打开
        light.on();
    }

    @Override
    public void undo() {
        // 调用接收者的方法：关闭
        light.off();
    }
}
